﻿using Microsoft.Extensions.DependencyInjection;
using Modules.Project.Repositories;
using PmSoft;

namespace Modules.Project
{
    [UseDI(ServiceLifetime.Scoped)]
    public class ProjectSecurityDepositRecordsService
    {
        private readonly ProjectSecurityDepositRecordsRepository projectSecurityDepositRecordsRepository;

        public ProjectSecurityDepositRecordsService(ProjectSecurityDepositRecordsRepository projectSecurityDepositRecordsRepository)
        {
            this.projectSecurityDepositRecordsRepository = projectSecurityDepositRecordsRepository;
        }

        public IPagedList<ProjectSecurityDepositRecords> GetProjectSecurityDepositRecords(ProjectSecurityDepositRecordsQuery query, int pageIndex, int pageSize)
        {
            return projectSecurityDepositRecordsRepository.GetProjectSecurityDepositRecords(query, pageIndex, pageSize);
        }

        public ProjectSecurityDepositRecords? GetProjectSecurityDepositRecords(int id)
        {
            return projectSecurityDepositRecordsRepository.Get(id);
        }

        public void Create(ProjectSecurityDepositRecords entity)
        {
            projectSecurityDepositRecordsRepository.Insert(entity);
        }

        public void Update(ProjectSecurityDepositRecords entity)
        {
            projectSecurityDepositRecordsRepository.Update(entity);
        }

        public void Deleted(int id)
        {
            projectSecurityDepositRecordsRepository.DeleteByEntityId(id);
        }

        public void Deletes(IEnumerable<int> ids)
        {
            foreach (var id in ids)
            {
                Deleted(id);
            }
        }
    }
}